# 编译器及编译选项
CC = gcc
INCLUDE_DIR = /home/iot25/lpp/apue/include
SRC_DIR = /home/iot25/lpp/apue/src
CLIENT_DIR = /home/iot25/lpp/apue/server
CFLAGS = -Wall -pthread -I/home/iot24/sqlite/include -I$(INCLUDE_DIR)
LDFLAGS = -L /home/iot25/lpp/sqlite/sqlite-amalgamation-3470200 -lpthread -lsqlite3

# 源文件列表
SOURCES = $(CLIENT_DIR)/server_main.c  $(wildcard $(SRC_DIR)/*.c)
OBJECTS = $(patsubst %.c, %.o, $(SOURCES))

# 最终目标文件
TARGET = server

# 默认目标：编译并链接生成可执行文件
all: $(TARGET)

# 链接目标文件
$(TARGET): $(OBJECTS)
	$(CC) -o $(TARGET) $(OBJECTS) $(LDFLAGS)

# 编译各个源文件
%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

# 清理目标文件和可执行文件
clean:
	rm -f $(OBJECTS) $(TARGET)

